<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 封装函数查看数组是否存在某个元素  ['苹果', '香蕉', '橘子', '荔枝', '梨子']
      function some(ele, arr = []) {
        let flag = false;
        for (let i = 0; i < arr.length; i++) {
          if (ele === arr[i]) {
            flag = true;
            break;
          }
        }
        return false;
      }
      let re = some("荔枝", ["苹果", "香蕉", "橘子", "荔枝", "梨子"]);
    </script>
  </body>
</html>
